import QtQuick
import QtQuick.Controls

Page {
    id: registerPage

    Column {
        anchors.centerIn: parent
        spacing: 10

        TextField {
            id: newUsernameField
            placeholderText: "新用户名"
            width: 200
        }

        TextField {
            id: newPasswordField
            placeholderText: "新密码"
            echoMode: TextInput.Password
            width: 200
        }

        Button {
            text: "注册"
            width: 200
            onClicked: {
                if (newUsernameField.text && newPasswordField.text) {
                    errorLabel.text = "注册成功！"
                } else {
                    errorLabel.text = "用户名和密码不能为空！"
                }
            }
        }

        Button {
            text: "返回登录"
            width: 200
            onClicked: {
                stackView.pop() // 返回登录页面
            }
        }

        Label {
            id: errorLabel
            color: "red"
        }
    }
}